import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sainbainu/common/values/colors.dart';

class CustomInput extends StatelessWidget {
  final TextEditingController? controller;
  final String? hintText;
  final bool obscureText;
  final Widget? suffixIcon;
  final TextInputType? keyboardType;

  const CustomInput({
    Key? key,
    this.controller,
    this.hintText,
    this.obscureText = false,
    this.suffixIcon,
    this.keyboardType = TextInputType.text,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 50,
      child: TextField(
        controller: controller,
        decoration: InputDecoration(
          enabledBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(100),
            borderSide: const BorderSide(color: AppColors.border),
          ),
          focusedBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(100),
            borderSide: const BorderSide(color: AppColors.border),
          ),
          errorBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(100),
            borderSide: const BorderSide(color: AppColors.danger),
          ),
          focusedErrorBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(100),
            borderSide: const BorderSide(color: AppColors.danger),
          ),
          // contentPadding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
          contentPadding: const EdgeInsets.only(left: 20),
          fillColor: Colors.white,
          filled: true,
          hintText: hintText?.tr,
          hintStyle: const TextStyle(fontSize: 14, height: 1.2),
          isDense: true,
          suffixIcon: suffixIcon ?? const SizedBox.shrink(),
        ),
        keyboardType: keyboardType,
        textInputAction: TextInputAction.go,
        cursorColor: AppColors.active,
        cursorErrorColor: AppColors.active,
        scrollPadding: const EdgeInsets.all(10),
        obscureText: obscureText,
        cursorHeight: 16,
      ),
    );
  }
}
